package com.lhz.model.constant;

import lombok.Getter;

/**
 * @author LiHuaZhi
 */
@Getter
public enum DataStatusEnum {

    // 有效
    VALID(1, "有效"),
    // 无效
    INVALID(2, "无效");

    DataStatusEnum(
            int code, String
            desc) {
        this.code = code;
        this.desc = desc;
    }

    private final int code;

    private final String desc;

    /**
     * 根据code获取desc
     *
     * @param code
     * @return
     */
    public static String getDesc(int code) {
        DataStatusEnum[] var1 = values();
        int var2 = var1.length;

        for (DataStatusEnum c : var1) {
            if (c.getCode() == code) {
                return c.desc;
            }
        }
        return null;
    }
}
